package net.zdsoft.wpchat.support.enums;

/**
 * 权限类型枚举
 *
 * @author xuan
 */
public enum PermissionTypeEnum {
    ALL(1), AREA(2), SCHOOL(3);

    private int value;

    public int getValue() {
        return value;
    }

    PermissionTypeEnum(int value) {
        this.value = value;
    }

    public static PermissionTypeEnum valueOf(int value) {
        PermissionTypeEnum permType = null;
        switch (value) {
        case 1:
            permType = ALL;
            break;
        case 2:
            permType = AREA;
            break;
        case 3:
            permType = SCHOOL;
            break;
        default:
            break;
        }
        return permType;
    }

    public String getDescription() {
        String desc = "";
        switch (this) {
        case ALL:
            desc = "无限制授权";
            break;
        case AREA:
            desc = "地区授权";
            break;
        case SCHOOL:
            desc = "学校授权";
            break;
        default:
            break;
        }
        return desc;
    }

    public String getEnDescription() {
        String desc = "";
        switch (this) {
        case ALL:
            desc = "all";
            break;
        case AREA:
            desc = "area";
            break;
        case SCHOOL:
            desc = "school";
            break;
        default:
            break;
        }
        return desc;
    }

    @Override
    public String toString() {
        return getDescription();
    }

}
